﻿using System;
using System.Collections.Generic;
using Presentation;
using Domain;

namespace PresentationTest
{
    public class FakeView : IView, ILog
    {
        public string FromName { get; set; }
        public string FromValue { get; set; }

        public string ToName { get; set; }
        public string ToValue { get; set; }

        public string[] Currencies { get; set; }

        public Dictionary<string, string> Quotations { get; set; }

        public string NewName { get; set; }
        public string NewValue { get; set; }

        public string ErrorMessage { get; set; }

        public event Action OnConvertClick;
        public event Action OnSaveQuotationsClick;
        public event Action OnAddCurrencyClick;
        public event Action<ILog, bool> OnLogCheckedChanged;
        private string log;

        public void ConvertClick()
        {
            OnConvertClick();
        }

        public void SaveQuotationsClick()
        {
            OnSaveQuotationsClick();
        }

        public void AddCurrencyClick()
        {
            OnAddCurrencyClick();
        }

        public void EnableLoger()
        {
            OnLogCheckedChanged(this, true);
        }

        public void ClearError()
        {
            ErrorMessage = "";
        }

        public string Log
        {
            get
            {
                return log;
            }
            set
            {
                log += value + Environment.NewLine;
            }
        }
    }
}
